<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateYCategoryStatisticsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if(!Schema::hasTable('y_category_statistics')) {
            Schema::create('y_category_statistics', function (Blueprint $table) {
                $table->increments('category_statistics_id');
                $table->integer('category_statistics_category_id')->default(0)->comment('分组id');
                $table->integer('category_statistics_perday_num')->default(0)->comment('每日增长');
                $table->integer('category_statistics_date')->default(0)->comment('日期');

                $table->index('category_statistics_category_id');
                $table->index('category_statistics_perday_num');
                $table->index('category_statistics_date');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('y_category_statistics');
    }
}
